package com.fieldchain.ex.fa100.utils.chart.auxiliary.axis;

import android.graphics.Color;
import android.graphics.Paint;
import android.util.SparseArray;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.utils.Utils;

/**
 * Created by loro on 2017/2/8.
 */
public class MyYAxisRight extends YAxis {
    private int c1 = Color.parseColor("#FFB7C2CE");
    private int c2 = Color.parseColor("#55000000");
    private SparseArray<String> labels;
    private float maxValue;
    public SparseArray<String> getYLabels() {
        return labels;
    }
    public void setYLabels(SparseArray<String> labels) {
        this.labels = labels;
    }

    public SparseArray<String> getLabels() {
        return labels;
    }

    public void setLabels(SparseArray<String> labels) {
        this.labels = labels;
    }

    public float getMaxValue() {
        return maxValue;
    }

    public void setMaxValue(float maxValue) {
        this.maxValue = maxValue;
    }

    public MyYAxisRight() {
        setGridColor(c2);
        //是否绘制Y轴线
        setDrawAxisLine(false);
        //设置Y轴上每个横线是否显示
        setDrawGridLines(false);
        //设置是否绘制X轴上的对应值(标签)
        setDrawLabels(true);
        setTextSize(6);
        setTextColor(c1);
        setPosition(YAxisLabelPosition.INSIDE_CHART);//标签显示在内侧

        setEnabled(true);

    }
//
//    @Override
//    public boolean needsOffset() {
//        return false;
//    }

    public float getRequiredWidthSpace(Paint p) {
        return Utils.convertDpToPixel(5);
    }
}
